<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:107:"D:\phpStudy\WWW\oa\public/../application/admin\view\myself\myselfapprove_payment_application_form_save.html";i:1514441433;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>添加内容</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<style>
    /*table {width: 640px;height: 360px; margin: auto;margin-top: 2%}
    td {border:1px solid black;vertical-align: middle;text-align: center}
    th {border:1px solid black;vertical-align: middle;text-align: center}*/
</style>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">付款申请单详情</strong>&emsp;&emsp;<a
            style="color: #3a4bfb;font-weight: bold " href="javascript:history.go(-1)">返回上一步</a></div>
    <div style="margin-top: 2%">
        <lable style="float: left;" class="layui-form-lable">
            审批状态：
        </lable>
        <span>&emsp;<b>审批的位置</b></span>：<span><?php echo $payment_application_form['role']; ?></span>&emsp;&emsp;&emsp;&emsp;<span>审批结果</span>
        <?php if($payment_application_form['apply_states'] == 0): ?>  <span style="color: #0000aa"><?php echo $payment_application_form['apply_state']; ?></span>
        <?php elseif($payment_application_form['apply_states'] == 1): ?> <span style="color: black"><?php echo $payment_application_form['apply_state']; ?></span>
        <?php else: ?> <span style="color: red"><?php echo $payment_application_form['apply_state']; ?></span>
        <?php endif; if($payment_application_form['apply_states'] == 2): ?>
        <form class="layui-form">
            <h3 style="text-align: center;margin-top: 3%"><b>付款申请表</b></h3>
            <input type="hidden" value="2" name="bill_type_id" >
            <input type="hidden" value="<?php echo $payment_application_form['id']; ?>" id="id" name="id" >
            <div style=" margin-left: 3%" class="layui-inline">
                <lable style="float: left;margin-top: 3%" class="layui-form-lable">
                    审批流程：
                </lable>
                <div class="layui-input-inline">
                    <select id="payment_application_form_flow_id" name="payment_application_form_flow_id">
                        <?php if(is_array($payment_application_form_flow) || $payment_application_form_flow instanceof \think\Collection || $payment_application_form_flow instanceof \think\Paginator): $i = 0; $__LIST__ = $payment_application_form_flow;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                        <option value="<?php echo $vo['id']; ?>"><?php echo $vo['flow']; ?></option>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                </div>
            </div>
            <table style="margin-top: 2%" class="layui-table" lay-size="lg">
                <col width="100">
                <col width="180">
                <col width="150">
                <col width="150">
                <tr>
                    <td style="text-align: center;vertical-align: middle">付款事由：</td>
                    <td colspan="3"><input value="<?php echo $payment_application_form['account_payment']; ?>" type="text" lay-verify="required" class="layui-input" name="account_payment"></td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">收款单位：</td>
                    <td><input value="<?php echo $payment_application_form['payee']; ?>" type="text" lay-verify="required" class="layui-input" name="payee"></td>
                    <td style="text-align: center;vertical-align: middle">申请时间：</td>
                    <td><input value="<?php echo $payment_application_form['payment_application_form_time']; ?>" readonly="readonly" type="text" lay-verify="date|required" placeholder="yyyy-MM-dd" class="layui-input" id="payment_application_form_time" name="payment_application_form_time"></td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">银行账号：</td>
                    <td><input value="<?php echo $payment_application_form['bank_account']; ?>"  type="text" class="layui-input" lay-verify="num|required" name="bank_account"></td>
                    <td style="text-align: center;vertical-align: middle">开户银行：</td>
                    <td><input value="<?php echo $payment_application_form['account_opening_bank']; ?>" type="text" class="layui-input" lay-verify="required" name="account_opening_bank"></td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">付款金额：</td>
                    <td colspan="3"><input value="<?php echo $payment_application_form['amount_payment']; ?>" type="text" lay-verify="num|required" class="layui-input" name="amount_payment"></td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">付款方式：</td>
                    <td colspan="2" style="text-align: center;vertical-align: middle">
                        <?php if($payment_application_form['payment_method'] == '票汇'): ?>
                        <input name="payment_method"  value="票汇" title="票汇" checked="" type="radio">
                        <input name="payment_method"  value="信汇" title="信汇"  type="radio">
                        <input name="payment_method"  value="电汇" title="电汇"  type="radio">
                        <input name="payment_method"  value="现金" title="现金"  type="radio">
                        <?php elseif($payment_application_form['payment_method'] == '信汇'): ?>
                        <input name="payment_method"  value="票汇" title="票汇"  type="radio">
                        <input name="payment_method"  value="信汇" title="信汇" checked="" type="radio">
                        <input name="payment_method"  value="电汇" title="电汇"  type="radio">
                        <input name="payment_method"  value="现金" title="现金"  type="radio">
                        <?php elseif($payment_application_form['payment_method'] == '电汇'): ?>
                        <input name="payment_method"  value="票汇" title="票汇"  type="radio">
                        <input name="payment_method"  value="信汇" title="信汇"  type="radio">
                        <input name="payment_method"  value="电汇" title="电汇" checked="" type="radio">
                        <input name="payment_method"  value="现金" title="现金"  type="radio">
                        <?php else: ?>
                        <input name="payment_method"  value="票汇" title="票汇"  type="radio">
                        <input name="payment_method"  value="信汇" title="信汇"  type="radio">
                        <input name="payment_method"  value="电汇" title="电汇"  type="radio">
                        <input name="payment_method"  value="现金" title="现金" checked="" type="radio">
                        <?php endif; ?>
                    </td>
                    <td>转账号码：<input value="<?php echo $payment_application_form['tranfser_number']; ?>" type="text" lay-verify="num|required" class="layui-input" name="tranfser_number"></td>
                </tr>
            </table>
            <div class="layui-form-item">
                <div style="float: right;margin-top: 2%;margin-right: 10%" class="layui-input-block">
                    <button id="upload_payment_application_form" class="layui-btn" lay-submit="" lay-filter="demos">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
        <?php else: ?>
        <form class="layui-form">
            <h3 style="text-align: center;margin-top: 3%"><b>付款申请表</b></h3>
            <input type="hidden" value="2" name="bill_type_id" >
            <div style=" margin-left: 3%" class="layui-inline">
                <lable style="float: left;margin-top: 3%" class="layui-form-lable">
                    审批流程：
                </lable>
                <div class="layui-input-inline">
                    <select readonly="readonly">
                        <?php if(is_array($payment_application_form_flow) || $payment_application_form_flow instanceof \think\Collection || $payment_application_form_flow instanceof \think\Paginator): $i = 0; $__LIST__ = $payment_application_form_flow;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                        <option value="<?php echo $vo['id']; ?>"><?php echo $vo['flow']; ?></option>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                </div>
            </div>
            <table style="margin-top: 2%    " class="layui-table" lay-size="lg">
                <col width="100">
                <col width="180">
                <col width="150">
                <col width="150">
                <tr>
                    <td style="text-align: center;vertical-align: middle">付款事由：</td>
                    <td colspan="3"><input readonly="readonly" type="text" lay-verify="required" value="<?php echo $payment_application_form['account_payment']; ?>" class="layui-input" name="account_payment"></td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">收款单位：</td>
                    <td><input readonly="readonly" value="<?php echo $payment_application_form['payee']; ?>" type="text" lay-verify="required" class="layui-input" name="payee"></td>
                    <td style="text-align: center;vertical-align: middle">申请时间：</td>
                    <td><input value="<?php echo $payment_application_form['payment_application_form_time']; ?>" readonly="readonly" type="text" lay-verify="date|required" placeholder="yyyy-MM-dd" class="layui-input"  name="payment_application_form_time"></td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">银行账号：</td>
                    <td><input readonly="readonly" value="<?php echo $payment_application_form['bank_account']; ?>" type="text" class="layui-input" lay-verify="num|required" name="bank_account"></td>
                    <td style="text-align: center;vertical-align: middle">开户银行：</td>
                    <td><input readonly="readonly" value="<?php echo $payment_application_form['account_opening_bank']; ?>" type="text" class="layui-input" lay-verify="required" name="account_opening_bank"></td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">付款金额：</td>
                    <td colspan="3"><input readonly="readonly" value="<?php echo $payment_application_form['amount_payment']; ?>" type="text" lay-verify="num|required" class="layui-input" name="amount_payment"></td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">付款方式：</td>
                    <td colspan="2" style="text-align: center;vertical-align: middle">
                        <?php if($payment_application_form['payment_method'] == '票汇'): ?>
                        <input readonly="readonly" name="payment_method" value="票汇" title="票汇" checked="" type="radio">
                        <input readonly="readonly" name="payment_method" value="信汇" title="信汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="电汇" title="电汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="现金" title="现金"  type="radio">
                        <?php elseif($payment_application_form['payment_method'] == '信汇'): ?>
                        <input readonly="readonly" name="payment_method" value="票汇" title="票汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="信汇" title="信汇" checked="checked" type="radio">
                        <input readonly="readonly" name="payment_method" value="电汇" title="电汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="现金" title="现金"  type="radio">
                        <?php elseif($payment_application_form['payment_method'] == '电汇'): ?>
                        <input readonly="readonly" name="payment_method" value="票汇" title="票汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="信汇" title="信汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="电汇" title="电汇" checked="checked" type="radio">
                        <input readonly="readonly" name="payment_method" value="现金" title="现金"  type="radio">
                        <?php else: ?>
                        <input readonly="readonly" name="payment_method" value="票汇" title="票汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="信汇" title="信汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="电汇" title="电汇"  type="radio">
                        <input readonly="readonly" name="payment_method" value="现金" title="现金" checked="checked" type="radio">
                        <?php endif; ?>
                    </td>
                    <td>转账号码：<input readonly="readonly" value="<?php echo $payment_application_form['tranfser_number']; ?>" type="text" lay-verify="num|required" class="layui-input" name="tranfser_number"></td>
                </tr>
            </table>
        </form>
        <?php endif; ?>

    </div>


</div>
<a style="margin-top: 2%;float: right;margin-right: 35%;margin-bottom: 3%" class="layui-btn" href="<?php echo url('Myself/myselfapprove'); ?>">返回</a>

<a style="margin-top: 2%;float: right;margin-right: 15%;margin-bottom: 3%" class="layui-btn" href="<?php echo url('Myself/payment_application_form_excel'); ?>?id=<?php echo $payment_application_form['id']; ?>">下载打印的单据表格</a>

</body>
<script>
    layui.use('element', function () {
        var $ = layui.jquery
            , element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

        //触发事件
        var active = {
            tabAdd: function () {
                //新增一个Tab项
                element.tabAdd('demo', {
                    title: '新选项' + (Math.random() * 1000 | 0) //用于演示
                    , content: '内容' + (Math.random() * 1000 | 0)
                    , id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                })
            }

        };

        $('.site-demo-active').on('click', function () {
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function (elem) {
            location.hash = 'test=' + $(this).attr('lay-id');
        });

    });
</script>
<script>
    function sum() {
        var verity = /^\d+(\.\d+)?$/;
        var money_a = $('#money1').val();
        var money_b = $('#money2').val();
        var money_c = $('#money3').val();
        var money_d = $('#money4').val();
        var money_e = $('#money5').val();

        if (money_a == '') {
            money_a = 0;
        } else {
            money_a = parseFloat(money_a);
            //alert(typeof(money_a));
            if (money_a != '') {
                if (!verity.test(money_a)) {
                    layui.use(['layer'], function () {
                        var layer = layui.layer;
                        layer.tips('Hi，请输入数字', '#money1');
                    });
                }
            }
        }
        if (money_b == '') {
            money_b = 0;
        } else {
            money_b = parseFloat(money_b);
            if (money_b != '') {
                if (!verity.test(money_b)) {
                    layui.use(['layer'], function () {
                        var layer = layui.layer;
                        layer.tips('Hi，请输入数字', '#money2');
                    })
                }
            }
        }
        if (money_c == '') {
            money_c = 0;
        } else {
            money_c = parseFloat(money_c);
            //alert(typeof(money_c));
            if (money_c != '') {
                if (!verity.test(money_c)) {
                    layui.use(['layer'], function () {
                        var layer = layui.layer;
                        layer.tips('Hi，请输入数字', '#money3');
                    });
                }
            }
        }
        if (money_d == '') {
            money_d = 0;
        } else {
            money_d = parseFloat(money_d);
            //alert(typeof(money_d));

            if (money_d != '') {
                if (!verity.test(money_d)) {
                    layui.use(['layer'], function () {
                        var layer = layui.layer;
                        layer.tips('Hi，请输入数字', '#money4');
                    });
                }
            }
        }
        if (money_e == '') {
            money_e = 0;
        } else {
            money_e = parseFloat(money_e);
            //alert(typeof(money_e));
            if (money_e != '') {
                if (!verity.test(money_e)) {
                    layui.use(['layer'], function () {
                        var layer = layui.layer;
                        layer.tips('Hi，请输入数字', '#money5');
                    });
                }
            }
        }
        var sums = money_a + money_b + money_c + money_d + money_e;
        $('#total').val(sums)
    }
</script>
<script>
    layui.use(['form', 'layer', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#reimbursement_time'
        });
        //自定义验证规则
        form.verify({
            num: [/^[0-9]+(.[0-9]{1,2})?$/, '金额只能为数字，并且最多两位']

        });
        //监听提交
        form.on('submit(demos)', function (data) {
            var datas = JSON.stringify(data.field);
            //console.log(datas);
            var sub = 'submit';
            $.ajax({
                type: "post",
                url: "<?php echo url('Myself/myselfapprove_payment_application_form_saves'); ?>",
                data: {"data": datas, 'sub': sub},
                dataType: "json",
                success: function (a) {
                    //console.log(a);
                    if (a > 0) {
                        layer.msg('添加成功', {icon: 1});
                        window.setTimeout("window.location=\"<?php echo url('Myself/myselfapprove'); ?>\"", 2000);
                        //layer.close(admin);
                    } else {
                        layer.msg('添加失败', {icon: 2});
                        //layer.close(admin);
                        setTimeout(function () {
                            //使用  setTimeout（）方法设定定时2000<a href="https://www.baidu.com/s?wd=%E6%AF%AB%E7%A7%92&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWuHn4n1DkmynYmhu9uhcd0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHf4PWmsrHRdnWckPWnkrHmkrf" target="_blank" class="baidu-highlight">毫秒</a>
                            window.location.reload();//页面刷新
                        }, 2000);
                    }

                }

            });
            return false;
        });

    });
    layui.use('upload', function () {
        var $ = layui.jquery
            , upload = layui.upload
            , layer = layui.layer;

        //拖拽上传
        upload.render({
            elem: '#test10'
            , accept: 'file'
            , url: "<?php echo url('Apply/upload'); ?>"
            , auto: false
            , bindAction: '#uploads'
            , done: function (res) {
                if (res.code == 0) { //上传成功
                    layer.msg('上传成功', {icon: 1})
                }
                else if (res.code == 1) { //上传成功
                    layer.msg('上传成功1', {icon: 1})
                }
            }
        });
    });
</script>
</html>